package org.tea.inventory.db.util.excel;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import java.io.*;

public class CEVUtil {

    private static Log log = LogFactory.getLog(CEVUtil.class);

    /**
     * 依据后缀名判断读取的是否为Excel文件
     *
     * @param filePath
     * @return
     */
    public static boolean isExcel(String filePath) {
        if (filePath.matches("^.+\\.(?i)(xls)$")
                || filePath.matches("^.+\\.(?i)(xlsx)$")) {
            return true;
        }
        return false;
    }

    /**
     * 检查文件是否存在
     */
    public static boolean fileExist(String filePath) {
        if (filePath == null || filePath.trim().equals(""))
            return false;
        File file = new File(filePath);
        if (file == null || !file.exists()) {
            return false;
        }
        return true;
    }



}

